package operation;

import book.BookList;

import java.util.Scanner;

public class del implements IOperation{

    @Override
    public void work(BookList Booklist) {
        Scanner scanner = new Scanner(System.in);
        find findbyname = new find();
        System.out.print("请输入需要删除书籍的书名：");
        int number = findbyname.find_name(Booklist, scanner.next());
        if(number<0) {
            System.out.println("没有找到该书，删除失败！！！");
        } else {
            for (int i = number+1; i < Booklist.getCount()-1; i++) {
                Booklist.getBooklist()[i-1] = Booklist.getBooklist()[i];
            }
            Booklist.setCount(Booklist.getCount()-1);
        }
    }
}